//
//  ViewController.m
//  UI26_Work
//
//  Created by dllo on 16/8/18.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "ViewController.h"
#import "Masonry.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    UIImageView *backImageView = [UIImageView new];
    self.view.backgroundColor = [UIColor redColor];
    UIImage *image = [UIImage imageNamed:@"u=3175705112,4266855295&fm=23&gp=0.jpg"];
    [backImageView setImage:image];
    [self.view addSubview:backImageView];
    UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
    UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:blur];
    effectView.frame = self.view.bounds;
    [backImageView addSubview:effectView];
    [backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.bottom.mas_equalTo(0);
    }];
    
    UIImageView *singerImageView = [UIImageView new];
    singerImageView.image = [UIImage imageNamed:@"u=1377413493,2194527414&fm=23&gp=0.jpg"];
    [backImageView addSubview:singerImageView];
    [singerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.centerY.mas_equalTo(backImageView);
        make.width.height.mas_equalTo(backImageView.mas_width).multipliedBy(0.8);
        
    }];
    singerImageView.layer.cornerRadius = self.view.bounds.size.width * 0.4;
    singerImageView.layer.masksToBounds = YES;

    UIButton *MVButton = [UIButton buttonWithType:UIButtonTypeSystem];
     [MVButton setImage:[UIImage imageNamed:@"player_btn_mv_normal@2x副本-1"] forState:UIControlStateNormal];
    [MVButton setTintColor:[UIColor colorWithRed:0.286 green:0.757 blue:0.424 alpha:1.000]];
    [self.view addSubview:MVButton];
    [MVButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(30);
        make.width.mas_equalTo(40);
        make.centerX.mas_equalTo(singerImageView);
        make.bottom.mas_equalTo(singerImageView.mas_top).mas_offset(-20);
    }];
   
    UIButton *biaoZhunButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [biaoZhunButton setImage:[UIImage imageNamed:@"player_btn_bz_sel_normal"] forState:UIControlStateNormal];
    [biaoZhunButton setTintColor:[UIColor colorWithRed:0.286 green:0.757 blue:0.424 alpha:1.000]];
    [self.view addSubview:biaoZhunButton];
    [biaoZhunButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(MVButton);
        make.width.mas_equalTo(MVButton.mas_width);
        make.height.mas_equalTo(MVButton.mas_height);
        make.right.mas_equalTo(MVButton.mas_left).mas_offset(-20);
    }];
    
    UIButton *dtsButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [dtsButton setImage:[UIImage imageNamed:@"player_btn_dts_off"] forState:UIControlStateNormal];
    [dtsButton setTintColor:[UIColor colorWithRed:0.286 green:0.757 blue:0.424 alpha:1.000]];
    [self.view addSubview:dtsButton];
    [dtsButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(MVButton);
        make.width.mas_equalTo(MVButton.mas_width);
        make.height.mas_equalTo(MVButton.mas_height);
        make.left.mas_equalTo(MVButton.mas_right).mas_offset(20);
    }];

    UILabel *singerLabel = [UILabel new];
    singerLabel.text = @"一 陈奕迅 一";
    singerLabel.textAlignment = 1;
    [self.view addSubview:singerLabel];
    singerLabel.textColor = [UIColor whiteColor];
    [singerLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(MVButton);
        make.width.mas_equalTo(150);
        make.height.mas_equalTo(35);
        make.bottom.mas_equalTo(MVButton.mas_top).mas_offset(-10);
    }];
    
    UILabel *musicLabel = [UILabel new];
    musicLabel.text = @"十年";
    musicLabel.textAlignment = 1;
    musicLabel.textColor = [UIColor whiteColor];
    [self.view addSubview:musicLabel];
    [musicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(singerLabel);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(30);
        make.bottom.mas_equalTo(singerLabel.mas_top).mas_offset(-10);
    }];
    
    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [backButton setTintColor:[UIColor whiteColor]];
    [backButton setImage:[UIImage imageNamed:@"player_btn_close_normal"] forState:UIControlStateNormal];
    [self.view addSubview:backButton];
    [backButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(20);
        make.width.mas_equalTo(60);
        make.height.mas_equalTo(40);
    }];
    
    UILabel *songLabel = [UILabel new];
    songLabel.text = @"十年 一 陈奕迅";
    songLabel.textAlignment = 1;
    songLabel.textColor = [UIColor whiteColor];
    [self.view addSubview:songLabel];
    [songLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(180);
        make.height.mas_equalTo(30);
        make.centerX.mas_equalTo(singerImageView);
        make.top.mas_equalTo(singerImageView.mas_bottom).mas_offset(10);
    }];
    
    UISlider *play = [UISlider new];
    [play setThumbImage:[UIImage imageNamed:@"player_slider_playback_thumb"] forState:UIControlStateNormal];
    [play setMinimumTrackImage:[UIImage imageNamed:@"player_slider_playback_left"] forState:UIControlStateNormal];
    [play setMaximumTrackImage:[UIImage imageNamed:@"player_slider_playback_right"] forState:UIControlStateNormal];
    [self.view addSubview:play];
    [play mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(backImageView.mas_width).multipliedBy(0.7);
        make.top.mas_equalTo(songLabel.mas_bottom).mas_offset(10);
        make.centerX.mas_equalTo(songLabel);
        make.height.mas_equalTo(20);
    }];
    
    UILabel *currentTime = [UILabel new];
    currentTime.text = @"00:00";
    currentTime.textColor = [UIColor whiteColor];
    currentTime.textAlignment = 2;
    [self.view addSubview:currentTime];
    [currentTime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(80);
        make.height.mas_equalTo(30);
        make.right.mas_equalTo(play.mas_left).mas_offset(-5);
        make.centerY.mas_equalTo(play);
    }];
    
    UILabel *lastTime = [UILabel new];
    lastTime.text = @"04:17";
    lastTime.textColor = [UIColor whiteColor];
    lastTime.textAlignment = 0;
    [self.view addSubview:lastTime];
    [lastTime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(80);
        make.height.mas_equalTo(30);
        make.left.mas_equalTo(play.mas_right).mas_offset(5);
        make.centerY.mas_equalTo(play);
    }];

    UIButton *playButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [playButton setImage:[UIImage imageNamed:@"hp_player_btn_play_normal"] forState:UIControlStateNormal];
    [playButton setTintColor:[UIColor colorWithRed:0.286 green:0.757 blue:0.424 alpha:1.000]];
    [self.view addSubview:playButton];
    [playButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.mas_equalTo(backImageView.mas_width).multipliedBy(0.18);
        make.centerX.mas_equalTo(play);
        make.top.mas_equalTo(play.mas_bottom).mas_offset(0);
    }];
    
    UIButton *before = [UIButton buttonWithType:UIButtonTypeSystem];
    [before setImage:[UIImage imageNamed:@"hp_player_btn_pre_normal"] forState:UIControlStateNormal];
    [before setTintColor:[UIColor colorWithRed:0.286 green:0.757 blue:0.424 alpha:1.000]];
    [self.view addSubview:before];
    [before mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(playButton);
        make.height.width.mas_equalTo(backImageView.mas_width).multipliedBy(0.15);
        make.right.mas_equalTo(playButton.mas_left).mas_offset(-5);
    }];
    
    UIButton *behind = [UIButton buttonWithType:UIButtonTypeSystem];
    [behind setImage:[UIImage imageNamed:@"hp_player_btn_next_normal"] forState:UIControlStateNormal];
    [behind setTintColor:[UIColor colorWithRed:0.286 green:0.757 blue:0.424 alpha:1.000]];
    [self.view addSubview:behind];
    [behind mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(playButton);
        make.height.width.mas_equalTo(backImageView.mas_width).multipliedBy(0.15);
        make.left.mas_equalTo(playButton.mas_right).mas_offset(5);
    }];

    UIButton *load = [UIButton buttonWithType:UIButtonTypeSystem];
    [load setImage:[UIImage imageNamed:@"player_btn_download_normal"] forState:UIControlStateNormal];
    [load setTintColor:[UIColor whiteColor]];
    [self.view addSubview:load];
    [load mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(playButton);
        make.height.width.mas_equalTo(backImageView.mas_width).multipliedBy(0.15);
        make.top.mas_equalTo(playButton.mas_bottom).mas_offset(0);
    }];

    UIButton *xunHaun = [UIButton buttonWithType:UIButtonTypeSystem];
    [xunHaun setImage:[UIImage imageNamed:@"player_btn_repeat_normal"] forState:UIControlStateNormal];
    [xunHaun setTintColor:[UIColor whiteColor]];
    [self.view addSubview:xunHaun];
    [xunHaun mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(load);
        make.height.width.mas_equalTo(backImageView.mas_width).multipliedBy(0.15);
        make.right.mas_equalTo(load.mas_left).mas_offset(-10);
    }];

    UIButton *xin = [UIButton buttonWithType:UIButtonTypeSystem];
    [xin setImage:[UIImage imageNamed:@"player_btn_favorite_normal"] forState:UIControlStateNormal];
    [xin setTintColor:[UIColor whiteColor]];
    [self.view addSubview:xin];
    [xin mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(load);
        make.height.width.mas_equalTo(backImageView.mas_width).multipliedBy(0.15);
        make.right.mas_equalTo(xunHaun.mas_left).mas_offset(-10);
    }];

    UIButton *shouCang = [UIButton buttonWithType:UIButtonTypeSystem];
    [shouCang setImage:[UIImage imageNamed:@"player_btn_share_highlight"] forState:UIControlStateNormal];
    [shouCang setTintColor:[UIColor whiteColor]];
    [self.view addSubview:shouCang];
    [shouCang mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(load);
        make.height.width.mas_equalTo(backImageView.mas_width).multipliedBy(0.15);
        make.left.mas_equalTo(load.mas_right).mas_offset(10);
    }];

    UIButton *fenXiang = [UIButton buttonWithType:UIButtonTypeSystem];
    [fenXiang setImage:[UIImage imageNamed:@"player_btn_playlist_normal"] forState:UIControlStateNormal];
    [fenXiang setTintColor:[UIColor whiteColor]];
    [self.view addSubview:fenXiang];
    [fenXiang mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(load);
        make.height.width.mas_equalTo(backImageView.mas_width).multipliedBy(0.15);
        make.left.mas_equalTo(shouCang.mas_right).mas_offset(10);
    }];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
